package com.example.myandroidapp1.sql;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper{
	

	public static final String KEY_ROWID	= "_id";
	public static final String KEY_NAME	= "persons_name";
	public static final String KEY_HOTNESS	= "persons_hotness";
	
	private static final String DATABASE_NAME = "HotOrNotDb";
	private static final String DATABASE_TABLE = "People";
	private static final int DATABASE_VERSION = 1;
	

	public DBHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
		// TODO Auto-generated constructor stub
	}


	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		db.execSQL(" CREATE TABLE " + DATABASE_TABLE + " ( " + 
				KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
				KEY_NAME + " TEXT NOT NULL, " +
				KEY_HOTNESS + " TEXT NOT NULL )"
				);
		
	}


	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE);
		onCreate(db);
	}

}
